package com.android.scj.tc.bean;

import com.util.EncodingUtil;

/**
 *
 * 初始化请求
 * @author LiuYaDong
 */
public class InitRequest{
	/**
	 *  0	4	Datetime	UNIX当前时间，高位在前
	 4	1	BST Interval	BST间隔，单位毫秒，范围1-10ms
	 5	1	RetryInterval	交易重试间隔，单位毫秒，范围1-10ms
	 6	1	TxPower	功率级数，范围0-31；0：关闭天线，31：最大功率
	 7	1	PLLChannelID	信道号，范围0-1

	 */
	private static final String cmdcode = "F0";
	private String Datetime = "00000000";
	private String BST_Interval = "01";
	private String RetryInterval = "01";
	private String TxPower = "0A";
	private String PLLChannelID = "00";

	private InitRequest(){}
	public static CMD_55AA create(String bST_Interval,
								  String retryInterval, String txPower, String pLLChannelID) {
		InitRequest io = new InitRequest();
		io.Datetime = EncodingUtil.LongTosix(System.currentTimeMillis() / 1000, 8)
				.toUpperCase();
		io.BST_Interval = bST_Interval;
		io.RetryInterval = retryInterval;
		io.TxPower = txPower;
		io.PLLChannelID = pLLChannelID;
		return CMD_55AA.create(cmdcode, io.Datetime+io.BST_Interval+io.RetryInterval+io.TxPower+io.PLLChannelID);
	}

	public String getDatetime() {
		return Datetime;
	}
	public String getBST_Interval() {
		return BST_Interval;
	}
	public String getRetryInterval() {
		return RetryInterval;
	}
	public String getTxPower() {
		return TxPower;
	}
	public String getPLLChannelID() {
		return PLLChannelID;
	}
}
